@echo off

if "%PROJECT_ROOT%" =="" goto NoProjectRoot
if "%1" =="" goto NoStagingArea

echo Cleaning old staging...
rmdir /s /Q %1\staging
mkdir %1\staging
mkdir %1\staging\NetrekClient
mkdir %1\staging\Dependencies

echo Copying client source...
xcopy /s /Q %PROJECT_ROOT%\NetrekClient\*.* %1\staging\NetrekClient
echo Copying dependencies...
xcopy /s /Q %PROJECT_ROOT%\Dependencies\*.* %1\staging\Dependencies
xcopy /s /Q %PROJECT_ROOT%\Startup.cmd %1\staging\
xcopy /s /Q %PROJECT_ROOT%\BUILDING %1\staging
xcopy /s /Q %PROJECT_ROOT%\LICENSE %1\staging

goto End


:NoProjectRoot
echo Must be executed from a project environment.
goto End

:NoStagingArea
echo Please specify a staging area directory as an argument.

:End
